#include <algorithm>
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int maxArea(vector<int>& height) {
        int s=0,n=height.size();
        int i=0,j=n-1,ans=0,min_long=0;
        while(i<j)
        {
            min_long=min(height[i],height[j]);
            s=min_long*(j-i);
            ans=max(ans,s);
            if(height[i]==min_long)i++;
            else j--;
        }
        return ans;
    }
};